home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / PACKAGES / AWK320.ZIP / ARRAY.AWK < prev    next >
Text File  |  1990-02-08  |  248b  |  8 lines

  1. # demonstrate set operations on an array
  2.  
  3. $1 == "IN" { if ($2 in a) print $2, a[$2]; else print $2, "is not in a"; next}
  4. $1 == "DEL" { delete a[$2]; next }
  5. $0 == "ALL" { for (i in a) printf("a[%s] = %s\n", i, a[i]) }
  6. NF == 2 { a[$1] = $2 }
  7.  
  8.